﻿using RpcCentral.Model.DB;
using RpcHelper;
using RpcModel;
using SqlSugarHelper;

namespace RpcCentral.DAL.Repository
{
    internal class ContainerDAL : IContainerDAL
    {
        private IRepository<Contrainer> _Db;
        public ContainerDAL(IRepository<Contrainer> repository)
        {
            _Db = repository;
        }

        public Guid Find(ContainerType type, string conId)
        {
            return this._Db.Get(c => c.ContainerType == type && c.ContrainerId == conId, c => c.Id);
        }
        public Guid Reg(Contrainer add)
        {
            add.Id = Tools.NewGuid();
            add.AddTime = DateTime.Now;
            _Db.Insert(add);
            return add.Id;
        }
    }
}
